﻿
<template>
    <div>
        <treeselect v-model="pzoption.value" placeholder="请选择课程类别" noOptionsText="没有可选项...."  value-consists-of="LEAF_PRIORITY"   :normalizer="normalizer" :options="dataset" :multiple="dx" :show-count="true" :limit="3" />
    </div>
</template>

<script>
    Vue.component('treeselect', VueTreeselect.Treeselect);
    module.exports = {
        props: ['pzoption', 'isdx'],
        data() {
            return {
                dataset: [],
                props: {
                    multiple: false,
                  
                },
                normalizer(node) {
                    return {
                        id: node.lbdh,
                        label: node.lbxx,
                        children: node.children,
                    }
                }
            };
        },
        computed: {
            dx: function () {
                return this.isdx == "";
            }
        },
        mounted: function () {
            var chi = this;
            chi.$nextTick(function () {
                $.getJSON('/API/VIEWAPI.ashx?Action=QJJW_GETKCLB', {}, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        var tempdata = [{ lbdh: "all", lbxx: "全部课程", children: resultData.Result }];
                        chi.dataset = tempdata;
                    }
                })


            })

        }
    };
</script>